feat: add Statuses table migration#15
Conversation
…dd-status-table
There was a problem hiding this comment.
Pull request overview
Adds a new database migration to introduce a Statuses table for tracking maintenance issue progress updates, linking updates to both Issues and Users.
Changes:
- Create
Statusestable with FK relations toIssuesandUsers, plusdescription, optionalimage_url, andstatus_typeENUM. - Add indexes on
issue_idanduser_idto support common query patterns.
Comments suppressed due to low confidence (1)
src/database/migrations/20251027183315-create-statuses-table.js:64
status_typeis created withSequelize.ENUM(...), which creates a PostgreSQL enum type (typically named likeenum_Statuses_status_type).down()currently drops only the table, leaving the enum type behind; rolling back and re-running the migration can fail because the enum type already exists. Please updatedown()to also drop the generated enum type (similar to how other migrations drop enum types).
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('Statuses');
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'use strict'; | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| export default { |
There was a problem hiding this comment.
This migration is the only one in the repo using an ESM export default and a .js extension. With the project configured as "type": "module" and sequelize-cli driven by a CommonJS .sequelizerc, sequelize-cli will typically require() migrations; requiring an ESM .js file will throw ERR_REQUIRE_ESM. Align this file with the existing migrations (e.g., use .cjs and module.exports = { up, down }).
| export default { | |
| module.exports = { |
Added new Statuses table to track maintenance issue progress updates.
Includes relations to Issues and Users, with ENUM status field and performance indexes.
Successfully migrated and tested using Docker Postgres (fixpoint_db).